﻿<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="Sanpham.aspx.cs" Inherits="Admin_Sanpham" Title="Quản lý sản phẩm" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link rel="Stylesheet" href="/Online/CSS/Admin.css" type="text/css" />
    <style type="text/css">
        .cantrai
        {
            width: 300px;
            float: left;
            text-align: right;
            color: White;
        }
        .canphai
        {
            width: 710px;
            float: left;
            text-align: left;
            margin-left: 10px;
        }
        .white
        {
            color: White;
        }
        .GV
        {
            color: White;
            font-size: 17px;
        }
        .GV1
        {
            border: 1px solid #333;
            border-left-style: hidden;
            border-right-style: hidden;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="tieude">
        QUẢN LÝ SẢN PHẨM</div>
    <asp:Panel ID="pnht" runat="server">
        <div style="color: White; font-size: 17px;">
            Chọn hãng sản xuất:
            <asp:DropDownList ID="dlhangsx" Width="200px" runat="server" DataTextField="Tenhang"
                DataValueField="Mahang" AutoPostBack="true" 
                onselectedindexchanged="dlhangsx_SelectedIndexChanged">
            </asp:DropDownList>
            &nbsp;&nbsp;&nbsp;
            <asp:LinkButton CssClass="xc" ID="Themspmoi" runat="server" Text="Thêm sản phẩm mới"
                OnClick="Themspmoi_Click"></asp:LinkButton>
                &nbsp;&nbsp;&nbsp; <span style="float: right;
                    margin-right: 20px;">Tìm kiếm:
                    <asp:TextBox ID="timkiem" runat="server" onBlur="if(this.value=='')this.value='Nhập tên sản phẩm';"
                        onfocus="if(this.value=='Nhập tên sản phẩm')this.value='';" value="Nhập tên sản phẩm"></asp:TextBox>&nbsp;
                    <asp:Button ID="btnTim" runat="server" Text="Tìm kiếm" 
                onclick="btnTim_Click" /></span>
        </div>
        <div style="margin-top: 10px;">
            <asp:GridView ID="GVSP" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                DataKeyNames="Masp" CssClass="GV1" PageSize="16" Width="100%" PagerStyle-CssClass="GV"
                PagerStyle-ForeColor="White" onrowcommand="GVSP_RowCommand">
                <Columns>
                    <asp:TemplateField HeaderText="Xóa" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="20px" HeaderStyle-ForeColor="White">
                        <ItemTemplate>
                            <asp:ImageButton ID="lbXoa" runat="server" Width="20px" Height="20px" ImageUrl="~/Img/delete-24.png"
                                    OnClientClick="return confirm('Bạn chắc chắn muốn xóa ?')" CommandArgument='<%#Eval("Masp")%>'
                                    Text="Xóa" CommandName="Del" />
                    </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="ID" Visible="false">
                        <ItemTemplate>
                            <asp:Label ID="Ma" runat="server" Text='<%#Eval("Masp") %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                        <HeaderStyle HorizontalAlign="Center" />
                        <HeaderStyle ForeColor="White" />
                        <ItemStyle ForeColor="White" />
                        <ControlStyle ForeColor="White" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Tên sản phẩm">
                        <ItemTemplate>
                            <asp:HyperLink ID="hpten" runat="server" Text='<%#Eval("Tensp") %>' NavigateUrl='<%#"/Online/Admin/Sanpham.aspx?"+"m="+Eval("Masp") %>'
                                CssClass="HyperLink1"></asp:HyperLink>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Left" />
                        <HeaderStyle HorizontalAlign="Center" />
                        <HeaderStyle ForeColor="White" />
                        <ItemStyle ForeColor="White" />
                        <ControlStyle ForeColor="White" />
                    </asp:TemplateField>
                    <asp:BoundField DataField="Soluong" HeaderText="Số lượng" SortExpression="Soluong">
                        <ItemStyle HorizontalAlign="Center" />
                        <HeaderStyle HorizontalAlign="Center" />
                        <ItemStyle Width="80px" />
                        <HeaderStyle ForeColor="White" />
                        <ItemStyle ForeColor="White" />
                        <ControlStyle ForeColor="White" />
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="Hình ảnh">
                        <ItemTemplate>
                            <a href='<%#"/Online/Admin/Sanpham.aspx?"+"m="+Eval("Masp") %>'>
                                <asp:Image ID="hinhanh" runat="server" ImageUrl='<%#Eval("Hinhanh") %>' Width="80px"
                                    Height="80px" /></a>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                        <ItemStyle Width="85px" />
                        <ItemStyle Height="85px" />
                        <HeaderStyle HorizontalAlign="Center" />
                        <HeaderStyle ForeColor="White" />
                        <ItemStyle ForeColor="White" />
                        <ControlStyle ForeColor="White" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Giá bán">
                        <ItemTemplate>
                            <asp:Label ID="gia" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Giaban", "{0:0,0 VNĐ}")%> '></asp:Label>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                        <ItemStyle Width="150px" />
                        <HeaderStyle HorizontalAlign="Center" />
                        <HeaderStyle ForeColor="White" />
                        <ItemStyle ForeColor="White" />
                        <ControlStyle ForeColor="White" />
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </div>
    </asp:Panel>
    <asp:Panel ID="pnThemsp" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="pnanel" runat="server">
            <ContentTemplate>
                <div class="cantrai" style="text-align: right;">
                    Chọn nhà cung cấp:</div>
                <div class="canphai" style="text-align: left;">
                    <asp:DropDownList ID="dlNCC" runat="server" Width="200px" DataTextField="Tenncc"
                        DataValueField="Mancc" AutoPostBack="true">
                    </asp:DropDownList>
                </div>
                <div class="cantrai" style="text-align: right;">
                    Chọn hãng sản xuất:</div>
                <div class="canphai" style="text-align: left;">
                    <asp:DropDownList ID="dlHang" runat="server" Width="200px" DataTextField="Tenhang"
                        DataValueField="Mahang" AutoPostBack="true">
                    </asp:DropDownList>
                </div>
                <div class="cantrai" style="text-align: right;">
                    Tên sản phẩm:</div>
                <div class="canphai" style="text-align: left;">
                    <asp:TextBox ID="txttensp" runat="server" Width="705px"></asp:TextBox>
                </div>
                <div class="cantrai" style="text-align: right;">
                    Số lượng:</div>
                <div class="canphai" style="text-align: left;">
                    <asp:TextBox ID="txtsl" runat="server" Width="705px"></asp:TextBox>
                </div>
                <div class="cantrai" style="text-align: right;">
                    Giá nhập:</div>
                <div class="canphai" style="text-align: left;">
                    <asp:TextBox ID="txtgianhap" runat="server" Width="705px"></asp:TextBox>
                </div>
                <div class="cantrai" style="text-align: right;">
                    Tính năng nổi bật:</div>
                <div class="canphai" style="text-align: left; margin-bottom: 5px;">
                    <asp:TextBox ID="txttinhnang" runat="server" Height="100px" TextMode="MultiLine"
                        Width="705px"></asp:TextBox>
                </div>
                <div class="cantrai" style="text-align: right;">
                    Thông tin sản phẩm:</div>
                <div class="canphai">
                    <FCKeditorV2:FCKeditor ID="fckttsp" Height="500px" SkinPath="skins/office2003/" ToolbarSet="Default"
                        runat="server" BasePath="~/fckeditor/">
                    </FCKeditorV2:FCKeditor>
                </div>
                <div class="cantrai" style="text-align: right; margin-top: 10px;">
                    Khuyến mại:</div>
                <div class="canphai" style="text-align: left; margin-bottom: 5px;">
                    <asp:TextBox ID="txtkm" runat="server" Height="100px" TextMode="MultiLine" Width="705px"></asp:TextBox>
                </div>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="dlNCC" EventName="Load" />
                <asp:AsyncPostBackTrigger ControlID="dlHang" EventName="Load" />
            </Triggers>
        </asp:UpdatePanel>
        <asp:UpdateProgress ID="pro" runat="server" AssociatedUpdatePanelID="pnanel">
        </asp:UpdateProgress>
        <div class="cantrai" style="text-align: right;">
            Hình ảnh:</div>
        <div class="canphai" style="text-align: left;">
            <asp:FileUpload ID="hinhanh" runat="server" CssClass="white" />
        </div>
        <div class="cantrai" style="text-align: right;">
            Ảnh lớn:</div>
        <div class="canphai" style="text-align: left;">
            <asp:FileUpload ID="hinhanhto" runat="server" CssClass="white" />
        </div>
        <div class="cantrai" style="text-align: right;">
            Hiển thị:</div>
        <div class="canphai" style="text-align: left;">
            <asp:RadioButton CssClass="white" ID="ht" Checked="true" runat="server" GroupName="hienthi"
                Text="Hiển thị" />
            <asp:RadioButton CssClass="white" ID="kht" runat="server" GroupName="hienthi" Text="Không hiển thị" />
        </div>
        <div class="cantrai" style="text-align: right;">
            &nbsp;</div>
        <div class="canphai" style="text-align: left; margin-bottom: 10px;">
            <asp:Button ID="btnThem" runat="server" Text="Lưu sản phẩm" OnClick="btnThem_Click" />
            <asp:Button ID="btnHuy" runat="server" Text="Hủy bỏ" OnClick="btnHuy_Click" />
        </div>
        <div class="cantrai" style="text-align: right;">
            &nbsp;</div>
        <div class="canphai" style="text-align: center; color: White; font-style: italic;
            margin-bottom: 10px;">
            <asp:Label ID="tb" runat="server"></asp:Label>
        </div>
    </asp:Panel>
    <asp:Panel ID="pnEdit" runat="server">
        <div class="cantrai" style="text-align: right;">
            Chọn nhà cung cấp:</div>
        <div class="canphai" style="text-align: left;">
            <asp:DropDownList ID="dlNCCedit" runat="server" Width="200px" DataTextField="Tenncc"
                DataValueField="Mancc" AutoPostBack="true">
            </asp:DropDownList>
        </div>
        <div class="cantrai" style="text-align: right;">
            Chọn hãng sản xuất:</div>
        <div class="canphai" style="text-align: left;">
            <asp:DropDownList ID="dlhsxedit" runat="server" Width="200px" DataTextField="Tenhang"
                DataValueField="Mahang" AutoPostBack="true">
            </asp:DropDownList>
        </div>
        <div class="cantrai" style="text-align: right;">
            Tên sản phẩm:</div>
        <div class="canphai" style="text-align: left;">
            <asp:TextBox ID="txttenspedit" runat="server" Width="705px"></asp:TextBox>
        </div>
        <div class="cantrai" style="text-align: right;">
            Số lượng:</div>
        <div class="canphai" style="text-align: left;">
            <asp:TextBox ID="txtsledit" runat="server" Width="705px"></asp:TextBox>
        </div>
        <div class="cantrai" style="text-align: right;">
            Giá nhập:</div>
        <div class="canphai" style="text-align: left;">
            <asp:TextBox ID="txtgianhapedit" runat="server" Width="705px"></asp:TextBox>
        </div>
        <div class="cantrai" style="text-align: right;">
            Tính năng nổi bật:</div>
        <div class="canphai" style="text-align: left; margin-bottom: 5px;">
            <asp:TextBox ID="txttinhangedit" runat="server" Height="100px" TextMode="MultiLine"
                Width="705px"></asp:TextBox>
        </div>
        <div class="cantrai" style="text-align: right;">
            Thông tin sản phẩm:</div>
        <div class="canphai">
            <FCKeditorV2:FCKeditor ID="fckttspedit" Height="500px" SkinPath="skins/office2003/"
                ToolbarSet="Default" runat="server" BasePath="~/fckeditor/">
            </FCKeditorV2:FCKeditor>
        </div>
        <div class="cantrai" style="text-align: right; margin-top: 10px;">
            Khuyến mại:</div>
        <div class="canphai" style="text-align: left; margin-bottom: 5px;">
            <asp:TextBox ID="txtkmedit" runat="server" Height="100px" TextMode="MultiLine" Width="705px"></asp:TextBox>
        </div>
       
        <div class="cantrai" style="text-align: right;">
            Hiển thị:</div>
        <div class="canphai" style="text-align: left;">
            <asp:RadioButton CssClass="white" ID="htedit" Checked="true" runat="server" GroupName="hienthi"
                Text="Hiển thị" />
            <asp:RadioButton CssClass="white" ID="khtedit" runat="server" GroupName="hienthi"
                Text="Không hiển thị" />
        </div>
        <div class="cantrai" style="text-align: right;">
            &nbsp;</div>
        <div class="canphai" style="text-align: left; margin-bottom: 10px;">
            <asp:Button ID="btnSuaedit" runat="server" Text="Cập nhật sản phẩm" OnClick="btnSuaedit_Click" />
            <asp:Button ID="btnHuyedit" runat="server" Text="Hủy bỏ" 
                onclick="btnHuyedit_Click" />
        </div>
        <div class="cantrai" style="text-align: right;">
            &nbsp;</div>
        <div class="canphai" style="text-align: center; color: White; font-style: italic;
            margin-bottom: 10px;">
            <asp:Label ID="Label1" runat="server"></asp:Label>
        </div>
    </asp:Panel>
</asp:Content>

